package com.powerbank.financecenter.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 用户账户实体类
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("user_account")
public class UserAccount {

    /**
     * 主键ID
     */
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private Long id;

    /**
     * 用户ID
     */
    @TableField("user_id")
    private Long userId;

    /**
     * 账户类型：WALLET-钱包账户，DEPOSIT-押金账户
     */
    @TableField("account_type")
    private String accountType;

    /**
     * 账户余额
     */
    @TableField("balance")
    private BigDecimal balance;

    /**
     * 冻结金额
     */
    @TableField("frozen_amount")
    private BigDecimal frozenAmount;

    /**
     * 累计充值金额
     */
    @TableField("total_recharge")
    private BigDecimal totalRecharge;

    /**
     * 累计消费金额
     */
    @TableField("total_consume")
    private BigDecimal totalConsume;

    /**
     * 累计退款金额
     */
    @TableField("total_refund")
    private BigDecimal totalRefund;

    /**
     * 账户状态：ACTIVE-正常，FROZEN-冻结，CLOSED-关闭
     */
    @TableField("status")
    private String status;

    /**
     * 最后交易时间
     */
    @TableField("last_transaction_time")
    private LocalDateTime lastTransactionTime;

    /**
     * 备注
     */
    @TableField("remark")
    private String remark;

    /**
     * 创建时间
     */
    @TableField(value = "created_time", fill = FieldFill.INSERT)
    private LocalDateTime createdTime;

    /**
     * 更新时间
     */
    @TableField(value = "updated_time", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updatedTime;

    /**
     * 是否删除：0-否，1-是
     */
    @TableLogic
    @TableField("deleted")
    private Integer deleted;
}